-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include request/response info with Abort error #5639
Include request/response info with Abort error #5639
Conversation
addon/adapters/rest.js
Outdated
@@ -1228,7 +1228,8 @@ function ajaxError(adapter, payload, requestData, responseData) { | |||
} else if (responseData.textStatus === 'timeout') { | |||
error = new TimeoutError(); | |||
} else if (responseData.textStatus === 'abort' || responseData.status === 0) { | |||
error = new AbortError(); | |||
// TODO REVIEW should we use an adapter method for this, e.g. like handleResponse? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any ideas on this topic, should the ability to handle the abort error live on the adapter?
try {
error = adapter.handleAbort(
responseData.status,
responseData.headers,
responseData.errorThrown || '',
requestData
);
} catch (e) {
error = e;
}
addon/adapters/rest.js
Outdated
function handleAbort(requestData, responseData) { | ||
let msg = `Request failed: ${requestData.method} ${requestData.url} ${requestData.errorThrown || ''}`; | ||
let errors = [{ title: 'Adapter Error', detail: msg.trim(), status: responseData.status }]; | ||
return new AbortError(errors); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having this error with the url, and error response if available would be much better.
Currently we only use new AbortError();
5e8183f
to
c76d07c
Compare
let { status } = responseData; | ||
let msg = `Request failed: ${method} ${url} ${errorThrown || ''}`; | ||
let errors = [{ title: 'Adapter Error', detail: msg.trim(), status }]; | ||
return new AbortError(errors); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having this error with the url, and error response if available would be much better.
Currently we only use new AbortError();
- Add test for capturing error details
755bc27
to
c0eb4d8
Compare
Thanks so much! |
Likewise thank you @runspired |
@runspired any chance this one can be merged into an LTS? In v3.5 release...
Our app is not able to upgrade to 3.5 and just dies on loading, We're on 3.4 |
…ponse-info-with-abort-error Include request/response info with Abort error
Currently the
AbortError
does not have any context about the request/response.This PR adds the request method, url and error if available...
The problem is that when you have this error there is no related info captured to identify why the adapter aborted. For example, using a service like bugsnag or raygun, the error may not have any information to help reproduce the problem in your application.